package com.starlz.jpa.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;

/**
 * @Description:
 * @Author: wangzi
 * @Date: 2018/11/12 11:13
 */
@Entity
public class Dept  implements Serializable {
    private int did;
    private int dno;
    private String dname;
    private String loc;

    @Id
    @Column(name = "id")
    public int getDid() {
        return did;
    }

    public void setDid(int id) {
        this.did = id;
    }

    @Basic
    @Column(name = "deptno")
    public int getDno() {
        return dno;
    }

    public void setDno(int deptno) {
        this.dno = deptno;
    }

    @Basic
    @Column(name = "dname")
    public String getDname() {
        return dname;
    }

    public void setDname(String dname) {
        this.dname = dname;
    }

    @Basic
    @Column(name = "loc")
    public String getLoc() {
        return loc;
    }

    public void setLoc(String loc) {
        this.loc = loc;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dept dept = (Dept) o;
        return did == dept.did &&
                dno == dept.dno &&
                Objects.equals(dname, dept.dname) &&
                Objects.equals(loc, dept.loc);
    }

    @Override
    public int hashCode() {

        return Objects.hash(did, dno, dname, loc);
    }
}
